j3deditor.bin.editor
Class Scene2D

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by j3deditor.bin.editor.Scene2D
All Implemented Interfaces:
VirtualCamera, VirtualScene, VirtualScene2D, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class Scene2D
extends javax.swing.JPanel
implements VirtualScene2D, VirtualCamera, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener

Interface for manipulating a geometry. Visualizes the vertices and edges of a polygonal mesh.

Author:
Risto Seene
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Scene2D(int viewPoint)
          Creates an instance of Scene2D with the specified viewpoint.
 
Method Summary
 void flip()
          Flips this scene.
 VirtualCamera getCamera()
          Returns the camera of this scene.
 GeometryManipulator getGeometryManipulator()
          Returns the GeometryManipulator object that this scene uses for getting geometry information.
 float[] getOffset()
          Returns the location of camera on scene X, Y axes.
 float getScale()
          Returns the camera Z location.
 int getTexCoordSet()
          Returns the texture coordinate set this scene shows if it would be of type of Axes2D.TEX.
 int getViewPoint()
          Returns the viewpoint of the scene camera.
 void keyPressed(java.awt.event.KeyEvent e)
          If T, R or S key is pressed the corresponding transformation mode is activated.
 void keyReleased(java.awt.event.KeyEvent e)
          Not in use.
 void keyTyped(java.awt.event.KeyEvent e)
          Not in use.
 void mouseClicked(java.awt.event.MouseEvent e)
          Not in use.
 void mouseDragged(java.awt.event.MouseEvent e)
          Border select or vertex transformation is performed.
 void mouseEntered(java.awt.event.MouseEvent e)
          Not in use.
 void mouseExited(java.awt.event.MouseEvent e)
          Not in use.
 void mouseMoved(java.awt.event.MouseEvent e)
          Not in use.
 void mousePressed(java.awt.event.MouseEvent e)
          Various things will be done.
 void mouseReleased(java.awt.event.MouseEvent e)
          Various things will be done.
 void moveFocus(float move1, float move2)
          Moves the virtual focus of the camera.
 void paintComponent(java.awt.Graphics graphics)
          Draws the scene on this panel.
protected  void paintContent(java.awt.Graphics graphics)
          Draws the content of this scene.
 void rotateCamera(float angle, float angleZ)
          Not in use.
 void setEdgeVisibility(boolean visibility)
          Enables/disables the visibility of edges.
 void setGeometryEditorListener(GeometryEditorListener l)
          Sets the geometry editor listener.
 void setGeometryManipulator(GeometryManipulator gm)
          Sets the GeometryManipulator this scene gets its geometry data.
protected  void setImage(java.awt.Image image)
          Sets the background image of this scene.
 void setTexCoordSet(int texCoordSet)
          Sets the texture coordinate set this scene shows if it would be of type of Axes2D.TEX.
 void zoomCamera(float zoom)
          Zooms the camera in/out.
 void updateView(java.lang.Object sender)
          Updates the image of this Scene2D if this scene is synchronizable or the caller of this method is this Scene2D object.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scene2D

public Scene2D(int viewPoint)
Creates an instance of Scene2D with the specified viewpoint.

Parameters:
viewPoint - Axes2D.TEX, Axes2D.POS_X, Axes2D.POS_Y, Axes2D.POS_Z, Axes2D.NEG_X, Axes2D.NEX_Y or Axes2D.NEG_Z
Method Detail

setGeometryManipulator

public void setGeometryManipulator(GeometryManipulator gm)
Sets the GeometryManipulator this scene gets its geometry data.

Parameters:
gm - GeometryManipulator

setGeometryEditorListener

public void setGeometryEditorListener(GeometryEditorListener l)
Sets the geometry editor listener.

Parameters:
l - listener

setImage

protected void setImage(java.awt.Image image)
Sets the background image of this scene. Shown when in texture coordinate mode.

Parameters:
image - image

paintComponent

public void paintComponent(java.awt.Graphics graphics)
Draws the scene on this panel.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
graphics - graphics

paintContent

protected void paintContent(java.awt.Graphics graphics)
Draws the content of this scene.

Parameters:
graphics - graphics

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Various things will be done.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Various things will be done.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - mouse event

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Not in use.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - doesn't do anything

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Not in use.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - doesn't do anything

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Not in use.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - doesn't do anything

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Not in use.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - doesn't do anything

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Border select or vertex transformation is performed.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - mouse event

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
If T, R or S key is pressed the corresponding transformation mode is activated.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
e - key event

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Not in use.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
e - doesn't do anything

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Not in use.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
e - doesn't do anything

getCamera

public VirtualCamera getCamera()
Returns the camera of this scene.

Specified by:
getCamera in interface VirtualScene
Returns:
the camera of this scene

moveFocus

public void moveFocus(float move1,
                      float move2)
Moves the virtual focus of the camera.

Specified by:
moveFocus in interface VirtualCamera
Parameters:
move1 - movement of the focus along the X-axis of the camera. Difference, not absolute position
move2 - movement of the focus along the Y-axis of the camera. Difference, not absolute position

zoomCamera

public void zoomCamera(float zoom)
Zooms the camera in/out.

Specified by:
zoomCamera in interface VirtualCamera
Parameters:
zoom - the amount to zoom

rotateCamera

public void rotateCamera(float angle,
                         float angleZ)
Not in use.

Specified by:
rotateCamera in interface VirtualCamera
Parameters:
angle - doesn't do anything
angleZ - doesn't do anything

flip

public void flip()
Flips this scene.


getViewPoint

public int getViewPoint()
Returns the viewpoint of the scene camera. Axes2D.TEX, Axes2D.POS_X, Axes2D.POS_Y, Axes2D.POS_Z, Axes2D.NEG_X, Axes2D.NEX_Y or Axes2D.NEG_Z

Returns:
the viewpoint of the scene camera

getScale

public float getScale()
Returns the camera Z location.

Returns:
the camera Z location

getOffset

public float[] getOffset()
Returns the location of camera on scene X, Y axes.

Returns:
the location of camera on scene X, Y axes

getGeometryManipulator

public GeometryManipulator getGeometryManipulator()
Returns the GeometryManipulator object that this scene uses for getting geometry information.

Returns:
the GeometryManipulator object that this scene uses for getting geometry information

setEdgeVisibility

public void setEdgeVisibility(boolean visibility)
Enables/disables the visibility of edges.

Parameters:
visibility - if true edges will be visible, otherwise invisible

updateView

public void updateView(java.lang.Object sender)
Updates the image of this Scene2D if this scene is synchronizable or the caller of this method is this Scene2D object.

Parameters:
sender - method caller

getTexCoordSet

public int getTexCoordSet()
Returns the texture coordinate set this scene shows if it would be of type of Axes2D.TEX.

Returns:
the texture coordinate set this scene shows if it would be of type of Axes2D.TEX

setTexCoordSet

public void setTexCoordSet(int texCoordSet)
Sets the texture coordinate set this scene shows if it would be of type of Axes2D.TEX.

Parameters:
texCoordSet - texture coordinate set